

package cn.shengchao.examstar.comment.acl.adapters.clients;

import cn.shengchao.examstar.comment.acl.ports.clients.IUserClient;
import cn.shengchao.examstar.comment.domain.valobj.Student;
import cn.shengchao.examstart.user.ohs.local.appservices.UserAppService;
import cn.shengchao.examstart.user.ohs.local.messages.UserInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserClient implements IUserClient {

    @Autowired
    private UserAppService userAppService;

    @Override
    public Student getStudentInfo(Long studentId) {
        UserInfoDto userInfo = userAppService.getUserInfo(studentId);
        return Student.builder().id(studentId).name(userInfo.getNickName()).headUrl(userInfo.getAvatarUrl()).build();
    }
}
